package com.smart.controller.app;

import java.util.List;
import com.smart.util.Messages;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import com.smart.entity.SiteInspection;
import com.smart.dto.AppSiteInspectionDto;
import io.swagger.annotations.ApiOperation;
import com.smart.controller.BaseController;
import com.smart.service.SiteInspectionService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lgb
 * @date 2020年6月22日 上午10:18:05
 * Copyright (C) 深圳工勘科技
 * @说明: app端巡检
 **/
@RestController
@RequestMapping("/app/site_inspection")
@Api(value="siteInspection",tags="智慧工地-巡检管理")
public class AppSiteInspectionController extends BaseController{

	@Resource
	private SiteInspectionService siteInspectionService;
	
	@ApiOperation(value="app新增工地巡检",notes="app新增工地巡检")
	@PostMapping(value="/add")
	public Messages<String> save(@RequestBody AppSiteInspectionDto dto){
		String res=siteInspectionService.appSaveSiteInspection(dto);
		return Messages.success(res);
	}
	
	@ApiOperation(value="app获取工地巡检列表",notes="app获取工地巡检列表")
	@GetMapping(value="/page")
	public Messages<List<SiteInspection>> page(String createTime,
			@RequestParam(name="pageNum")Integer pageNum,
			@RequestParam(name="pageSize")Integer pageSize){ 
		IPage<SiteInspection> page=
				siteInspectionService.findPage(pageNum,pageSize,createTime);
		return Messages.success(page.getRecords());
	}
	
}